<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
if (!defined("Odds_lib_include")){
	define("Odds_lib_include", 1);
/**
 * 轉換賠率
 * @param	intLType 樂透種類序號
 * @param	intBID：下注種類
 * @param	flOdds：賠率
 * @return	Fload
 */
	function ConvertOdds($intLType, $intBT, $flOdds){
		$arrPrecision[1] = array(1 => 2, 2 => 3, 3 => 3,
								 4 => 2, 5 => 3, 6 => 3, 
								 7 => 1, 8 => 1, 9 => 1, 10 => 1, 11 => 1, 
								 12 => 3, 13 => 3, 14 => 3, 15 => 3, 
								 16 => 3, 17 => 3, 18 => 2, 
								 19 => 3, 20 => 3, 
								 21 => 2, 22 => 2, 23 => 2, 24 => 2, 25 => 2, 26 => 2, 27 => 3, 
								 28 => 2, 29 => 2, 30 => 3,
								 31 => 2,
								 32 => 2, 33 => 1, 34 => 1,
								 35 => 2, 36 => 2, 37 => 1,
								 38 => 2, 39 => 2, 40 => 1,
								 41 => 2, 42 => 1, 43 => 1						 
								 );

		$arrPrecision[2] = array(51 => 2, 52 => 3, 53 => 3,
								 54 => 2, 55 => 3, 56 => 3,
								 57 => 2, 58 => 3, 59 => 3,
								 60 => 3, 61 => 1, 62 => 3, 63 => 3,
								 64 => 1, 65 => 1, 66 => 1, 67 => 1,
								 68 => 2, 69 => 2, 70 => 2, 71 => 2, 72 => 2,
								 73 => 2, 74 => 2, 75 => 2, 76 => 2, 77 => 2,
								 78 => 1, 79 => 1, 80 => 2, 81 => 2, 82 => 3, 83 => 3, 
								 84 => 3, 85 => 3, 86 => 3, 
								 87 => 2, 88 => 2, 89 => 2,
								 90 => 2, 91 => 2, 92 => 0, 93 => 1
								 );//

		$arrPrecision[3] = array(1 => 1, 2 => 1, 3 => 1, 4 => 1, 5 => 1, 6 => 1,
								 7 => 0, 8 => 0, 9 => 0, 10 => 0,
								 11 => 0,
								 12 =>2, 13 => 1, 14 => 3, 15 => 3, 16 => 3, 17 => 3,
								 18 => 2, 19 => 2, 20 => 2, 21 => 2,
								 22 => 3
								 );

		$arrPrecision[4] = array(1 => 2, 2 => 3, 3 => 3, 4 => 3, 
								 5 => 2, 6 => 2, 7 => 2, 8 => 2, 
								 9 => 3, 10 => 3, 
								 11 => 3, 12 => 3, 13 => 3, 
								 15 => 2, 	16 => 2, 17 => 2, 18 => 2, 19 => 2, 20 => 2, 21 => 2, 22 => 2, 23 => 2, 24 => 2, 
								 25 => 2, 26 => 2, 27 => 2, 28 => 2, 
								 29 => 2, 
								 30 => 2, 31 => 2, 32 => 2, 33 => 2, 34 => 2, 35 => 2
								 );

		$intPrecision = $arrPrecision[$intLType][$intBT];
		//print $intLType."=".$intBT."=".$intPrecision;
		if($intPrecision == null)$intPrecision = 0;
		$flOdds = round($flOdds, $intPrecision);
		return $flOdds;
	}

/**
 * 兩面賠率 +1
 * @param	intLType 樂透種類序號
 * @param	intBID：下注種類
 * @param	flOdds：賠率
 * @return	Fload
 */
	function ConvertOddsPlus($intLType, $intBT, $flOdds){
		$arrPlus[1] = array(2 => 1,
							3 => 1,
							5 => 1,
							6 => 1,
							12 => 1,
							13 => 1,
							16 => 1,
							27 => 1);

		$arrPlus[2] = array(52 => 1,
							53 => 1,
							55 => 1,
							56 => 1,
							58 => 1,
							59 => 1,
							62 => 1,
							63 => 1,
							84 => 1,
							85 => 1,
							86 => 1);

		$arrPlus[3] = array(14 => 1,
							15 => 1,
							16 => 1,
							17 => 1);

		$arrPlus[4] = array(2 => 1,
							3 => 1,
							4 => 1,
							9 => 1,
							10 => 1,
							11 => 1,
							12 => 1,
							13 => 1);

		return $flOdds += (int)$arrPlus[$intLType][$intBT];
	}
//-------------------------------------------------------//
//WagerForm_lib End
}
?>